// 使用示例
loadScript('https://m.h5.7723.com/static/js/sdk_pay.js', function(err) {
    if (err) {
        console.error('加载出错');
    } else {
        console.log('加载成功');
        // 在这里使用加载的库
        // 初始化
        // 登录
        qiqi23_login();
    }
});

function qiqi23_login(){
    var queryParams = getQueryParams();
    console.log(queryParams);
    queryParams.cid = cid;
    queryParams.gid = gid;
    faXingLogin(queryParams);

}

function getQueryParams() {
    var urlParams = new URLSearchParams(window.location.search);
    var params = {};
    for (var param of urlParams.entries()) {
        params[param[0]] = param[1];
    }
    return params;
}



function qiqi23_creterole(data){

    if(data.is_save == 1){

        var roleParams = {
            cpgameid: 'cpgameid',
            qqesuid: 'qqesuid',
            channelid: 'channelid',
            cpguid: 'cpguid',
            rolename: 'rolename',
            serverid: 'serverid',
            level: 'level'
        };
        // 进入游戏
        SbPulSdk.createRole(roleParams);

    }else{

        var roleParams = {
            cpgameid: 'cpgameid',
            qqesuid: 'qqesuid',
            channelid: 'channelid',
            cpguid: 'cpguid',
            rolename: 'rolename',
            serverid: 'serverid',
            level: 'level',
            servername: 'servername',
            vip: 'vip'
        };
        // 进入游戏
        SbPulSdk.loginRole(roleParams);

    }
}



function qiqi23_pay(data){
    var queryParams = getQueryParams();
    data.userName = queryParams.userName;
    data.gameUrl = window.location.href;
    console.log("7723支付数据：",data);

    BZPAY.callPay(data.userId, data.userName, data.gameId, data.goodsId, data.goodsName, data.money,
        data.egretOrderId, data.channelExt, data.ext, data.gameUrl, data.time, data.agentid, data.sign);
}
